package com.onesports.intelligent.k12.polarlight.enums;

import com.baomidou.mybatisplus.annotation.IEnum;
import com.fasterxml.jackson.annotation.JsonValue;
import com.onesports.framework.kit.common.util.ParamUtils;

/**
* @author xiaobin.liu
* @date 2022/3/26 15:39
* @Description: 性别枚举
*/
public enum GenderEnum implements IEnum<String> {
    /**
     * 男
     */
    MAN("1","男"),
    WOMAN("2","女");

    private final String value;
    private final String desc;

    GenderEnum(String value, String desc){
        this.value = value;
        this.desc = desc;
    }

    public static GenderEnum getByDesc(String desc) {
        for (GenderEnum item : GenderEnum.values()) {
            if (ParamUtils.equals(item.desc, desc)) {
                return item;
            }
        }
        return null;
    }

    public static GenderEnum getByValue(String value) {
        for (GenderEnum item : GenderEnum.values()) {
            if (ParamUtils.equals(item.value, value)) {
                return item;
            }
        }
        return null;
    }


    @Override
    public String getValue() {
        return this.value;
    }

    @JsonValue
    public String getDesc() {
        return this.desc;
    }


}
